import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from sqstack import SqStack
#The standard solution involves using push and pop operations on a stack to determine if the stack is empty, which can save a significant amount of variables, such as cnt.
# def match(stack,len_stack):
#     cnt_1=cnt_2=cnt_3=cnt_4=cnt_5=cnt_6=0
#     for i in range(len_stack):
#         a = stack.pop()
#         if a == "(":
#             cnt_1 += 1
#         if a == ")":
#             cnt_2 += 1
#         if a == "[":
#             cnt_3 += 1
#         if a == "]":
#             cnt_4 += 1
#         if a == "{":
#             cnt_5 += 1
#         if a == "}":
#             cnt_6 += 1
#     if cnt_1==cnt_2 and cnt_3==cnt_4 and cnt_5==cnt_6:
#         return True
#     return False

# if __name__ == "__main__":
#     s = "aaa()aaa{}aaaa[]a[}}}}]"
#     my_stack = SqStack()
#     for i in range(len(s)):
#         my_stack.push(s[i])
#     print(match(my_stack,len(s)))